/*
 * main.cc
 *
 *  Created on: Nov 28, 2010
 *      Author: fify
 */

#include <stdio.h>
#include <iostream>

using namespace std;

const int MAX = 205;

int x1[MAX], x2[MAX];
int y1[MAX], y2[MAX];
int z1[MAX], z2[MAX];

double a, b, c, d;

int alli, foe;

void solve()
{
	int out = 1;
	for(int j = 0;j<1000000;j++)
	{
		out = 1;

		for(int i = 0;i<alli;i++)
		{
			if(a * x1[i] + b * y1[i] + c * z1[i] + d > 0)
			{
				// Adding x1[i]^2 + y1[i]^2 + z1[i]^2 + 1 to the inequality.
				a -= x1[i];
				b -= y1[i];
				c -= z1[i];
				d -= 1;

				out = 0;
			}
		}

		for(int i = 0;i<foe;i++)
		{
			if(a * x2[i] + b * y2[i] + c * z2[i] + d <= 0)
			{
				// Decrease x2[i]^2 + y2[i]^2 + z2[i]^2 + 1 to the inequality.
				a += x2[i];
				b += y2[i];
				c += z2[i];
				d += 1;

				out = 0;
			}
		}
		//cout << j << endl;

		if(out)
		{
			break;
		}
	}

	if(!out)
		while(1);
/*
	for(;1;)
	{
		double x, y, z;
		scanf("%lf%lf%lf", &x, &y, &z);
		printf("%lf\n", a * x + b * y + c * z + d);
	}
	*/
}

int main()
{
	while(scanf("%d", &alli) != EOF && alli >= 0)
	{
		for(int i = 0;i<alli;i++)
		{
			scanf("%d%d%d", &x1[i], &y1[i], &z1[i]);
		}

		scanf("%d", &foe);

		for(int i = 0;i<foe;i++)
		{
			scanf("%d%d%d", &x2[i], &y2[i], &z2[i]);
		}

		solve();

		printf("%lf %lf %lf %lf\n", a, b, c, d);
	}

	return 0;
}
